<%--
  Created by IntelliJ IDEA.
  User: zjsxx
  Date: 2018/1/16
  Time: 13:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from www.zi-han.net/theme/hplus/login_v2.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:49 GMT -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>H+ 后台主题UI框架 - 登录</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.min.css" rel="stylesheet">
    <link href="/css/style.min.css" rel="stylesheet">
    <link href="/css/login.min.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>


</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>[ EasyLink ]</h1>
                </div>
                <div class="m-b"></div>
                <h4>欢迎使用 <strong>EasyLink</strong></h4>
                <ul class="m-b">
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 连接世界，连接你我</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 快速接入</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优质稳定</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 支持多种传感器</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 谢子豪出品</li>
                </ul>
                <strong>还没有账号？ <a href="/public/register">立即注册&raquo;</a></strong>
            </div>
        </div>
        <div class="col-sm-5">
            <%--<form method="post" action="#">--%>
            <div class="formstyle">
                <h4 class="no-margins">登录：</h4>
                <p class="m-t-md">登录到EasyLink</p>
                <input id="userLoginName" type="text" class="form-control uname" placeholder="用户名"/>
                <input id="userPassword" type="password" class="form-control pword m-b" placeholder="密码"/>
                <a href="#">忘记密码了？</a>
                <button id="loginBtn" class="btn btn-success btn-block">登录</button>
            </div>
            <%--</form>--%>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2018 All Rights Reserved. EasyLink
        </div>
    </div>
</div>
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/jquery.json.js"></script>
<script src="/js/jquery.cookie.js"></script>
<script>
    $(document).ready(function () {
        //当登录按钮被点击
        $("#loginBtn").click(function () {
            var userLoginName;
            var userPassword;
            userLoginName = $("#userLoginName").val();
            userPassword = $("#userPassword").val();
            if (userLoginName == '' || userPassword == '') {
                alert('账号或者密码不可以为空');
            } else {
                $.ajax({
                    type: 'POST',
                    url: '/user/login',
                    dataType: 'json',
                    contentType: "application/json; charset=utf-8",
                    data: $.toJSON({
                        "userLoginName": userLoginName,
                        "userPassword": userPassword
                    }),
                    success: function (message) {
                        if (message.status == 200) {
                            document.cookie = "easylink_user_token=" + message.data + ";path=/";
//                            $.cookie('easylink_user_token', message.data);
                            $(location).attr('href', '/userManager/index');

                        } else {
                            alert('账号密码错误');
                        }
                    },
                    error: function (message) {
                        console.log(message);
                    }
                });
            }

        });
    });
</script>
</body>


</html>
